<?php
ArrowController::importModel("org.arrowplatform.controls.presentation.table.filters.ArrowTableAbstractFilter");
class ArrowTableBooleanFilter extends ArrowAbstractTableFilter{
	
	public function configure(){
		parent::configure();
	}
	public function generateFilter($value){
		$values = array(1 => "Tak", "arrow_zero" => "Nie");
		$str = "<table>";
		
		// TODO unikalna nazwa w name
		foreach($values as $key => $label)
			$str.= '<tr><td>'.$label.'</td><td><input type="radio" name="'.$this->getField().'" field="'.$this->getField().'" '.(($value==$key)?'checked="checked"':'').' value="'.$key.'"  /></td></tr>';
		$str.= "</table>";
		$str.= '<div class="ctrl-popup-cancel"></div>';
		$str.= '<div class="ctrl-popup-submit"></div>';
		
		return $str;
	}
	
	public function generateSetFilterValues($value) {
		
		if($value == 1)
			$str = "<div class=\"ctrl-table-set-filter-value\" >Tak</div><a rel=\"{$this->getResetRegistry()}\" href=\"{$this->getResetLink()}\" ></a>";
		elseif($value = 'arrow_zero')
			$str = "<div class=\"ctrl-table-set-filter-value\" >Nie</div><a rel=\"{$this->getResetRegistry()}\" href=\"{$this->getResetLink()}\" ></a>";
		
		return $str;
	}
}
?>